package com.sj.purchase.modules.cost.domain.price;

import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.io.Serializable;
import java.util.Date;

/**
 * Created by yangrd on 2017/7/21.
 */
@Embeddable
public class SkuAvgPriceId implements Serializable {

    private String skuNo;

    @Temporal(TemporalType.DATE)
    private Date day;

    public SkuAvgPriceId() {
    }

    public SkuAvgPriceId(String skuNo, Date day) {
        this.skuNo = skuNo;
        this.day = day;
    }

    public String getSkuNo() {
        return skuNo;
    }

    public SkuAvgPriceId setSkuNo(String skuNo) {
        this.skuNo = skuNo;
        return this;
    }

    public Date getDay() {
        return day;
    }

    public SkuAvgPriceId setDay(Date day) {
        this.day = day;
        return this;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        SkuAvgPriceId that = (SkuAvgPriceId) o;

        if (skuNo != null ? !skuNo.equals(that.skuNo) : that.skuNo != null) return false;
        return day != null ? day.equals(that.day) : that.day == null;
    }

    @Override
    public int hashCode() {
        int result = skuNo != null ? skuNo.hashCode() : 0;
        result = 31 * result + (day != null ? day.hashCode() : 0);
        return result;
    }
}
